import datetime
from sqlalchemy import (
    BIGINT, CHAR, DATETIME, VARCHAR, Column, Integer, String, ForeignKey, DateTime, Float, Text, Boolean
)
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class sys_user(Base):
    __tablename__ = 'sys_user'

    user_id = Column(BIGINT, primary_key=True, nullable=False)
    dept_id = Column(BIGINT, nullable=True)  # 如果有外键，可以加上 ForeignKey('other_table.id')
    user_name = Column(VARCHAR(64), nullable=False)
    nick_name = Column(VARCHAR(64), nullable=False)
    user_type = Column(VARCHAR(10))
    email = Column(VARCHAR(128))
    phonenumber = Column(VARCHAR(20))
    sex = Column(CHAR(1))
    avatar = Column(VARCHAR(255))
    password = Column(VARCHAR(128), nullable=False)
    status = Column(CHAR(1))
    del_flag = Column(CHAR(1), default='0')
    login_ip = Column(VARCHAR(128))
    login_date = Column(DATETIME)
    create_by = Column(VARCHAR(64))
    create_time = Column(DATETIME)
    update_by = Column(VARCHAR(64))
    update_time = Column(DATETIME)
    remark = Column(VARCHAR(255))

    def __repr__(self):
        return f"<SysUser(user_name='{self.user_name}', nick_name='{self.nick_name}')>"

# 如果有外键关联的表，还需要定义 relationship 方法